///////////////////////////////////////////////////////////
// 
//  Sequence.h
//
//  Wiicussion
//  HCI 575 Class project
//  Spring 2007
// 
//  Authors:  Jeremy Bennett
//            Adam Faeth
//            Michael Oren
//
///////////////////////////////////////////////////////////

#ifndef _SEQUENCE_H_
#define _SEQUENCE_H_

// Local Includes
#include "Note.h"
#include "MyImage.h"

// SDL Includes
#include <sdl.h>

// System Includes
#include <vector>

class Sequence
{
public:
    // xPos, yPos, width, height, number of tracks
    Sequence( float x, float y, float width, float height, int iInst);
    ~Sequence();
    
    
    bool setRendPosition( const float *pPos );
    
    bool renderSequence( MyContext *pContext=NULL );
    
    bool postFrame();
    
    // Recording functions
    bool add(Note * pNote);
    bool add(unsigned int uiInst, unsigned int uiTrack);
    
    bool playback();              // starts the record/start timer

    // Playback/matching functions
    bool setTol(unsigned int iTol);     // sets the tolerance of a match
    bool match(unsigned int uiInst);     // 
	bool hasPassed();

    bool clear();
    
protected:
    int                 _uID;
    
    // Sequence UI Rendering
    float               _fRenderSize[2];
    float               _fRenderPos[2];
    
    // Sequence Description
    float               _fColor[4];
    
    // Track and indexes into 
    std::vector<Note *> _vNotes;  
    int                 _iStDraw;   // first to draw
    int                 _iStPlay;   // next to play
    
    // Timers
    unsigned int        _uiStart;
    unsigned int        _uiTol;
    
    // bottom positions for each instrument track
    float              *_fTrackPos;
    
    // Note size and position information
    float               _fNoteW;
    float               _fNoteH;
    unsigned int        _uiNoteTravelTime;
    
    bool                _bShowPlayLine;
    
    // TOXIC: Prototype
    MyImage             _image;
    
    static bool         s_bVerbose;
};

#endif // _SEQUENCE_H_

